import Cookies from 'js-cookie'

const TokenKey = 'vue_gblog_token'
const avatarKey = 'vue_gblog_avatar'
const nameKey = 'vue_gblog_name'
const permissionKey = 'vue_gblog_permission'

export function getToken() {
  return Cookies.get(TokenKey)
}
export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function getName() {
  return Cookies.get(nameKey)
}
export function setName(name) {
  return Cookies.set(nameKey, name)
}

export function getAvatar() {
  return Cookies.get(avatarKey)
}
export function setAvatar(avatar) {
  return Cookies.set(avatarKey, avatar)
}

export function getPermission() {
  return Cookies.get(permissionKey)
}
export function setPermission(permission) {
  return Cookies.set(permissionKey, permission)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
export function removeName() {
  return Cookies.remove(nameKey)
}
export function removeAvatar() {
  return Cookies.remove(avatarKey)
}
export function removePermission() {
  return Cookies.remove(permissionKey)
}
export function removeAllCookie() {
   Cookies.remove(TokenKey)
   Cookies.remove(avatarKey)
   Cookies.remove(nameKey)
   Cookies.remove(permissionKey)
}


